

    \filetitle{publish}{Compile PDF from report object}{report/publish}

	\paragraph{Syntax}

\begin{verbatim}
[OutpFile,Info] = P.publish(InpFile,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{P} {[} struct {]} - Report object created by the
  \texttt{report.new} function.
\item
  \texttt{InpFile} {[} char {]} - File name under which the compiled PDF
  will be saved.
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\item
  \texttt{OutpFile} {[} char {]} - Name of the resulting PDF.
\item
  \texttt{Info} {[} struct {]} - Information struct with details of
  building the PDF report; see Description.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}abstract=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - Abstract that will displayed on the
  title page.
\item
  \texttt{\textquotesingle{}abstractWidth=\textquotesingle{}} {[}
  numeric \textbar{} \emph{\texttt{1}} {]} - Width of the abstract on
  the page as a percentage of the full default width (between \texttt{0}
  and \texttt{1}).
\item
  \texttt{\textquotesingle{}author=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - List of authors on the title page
  separated with \texttt{\textbackslash{}and} or
  \texttt{\textbackslash{}\textbackslash{}}.
\item
  \texttt{\textquotesingle{}cleanup=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} {]} - Delete all
  temporary files created when compiling the report.
\item
  \texttt{\textquotesingle{}compile=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} {]} - Compile the
  source files to an actual PDF; if \texttt{false} only the source files
  are created.
\item
  \texttt{\textquotesingle{}date=\textquotesingle{}} {[} char \textbar{}
  \emph{\texttt{\textquotesingle{}\textbackslash{}today\textquotesingle{}}}
  {]} - Date on the title page.
\item
  \texttt{\textquotesingle{}display=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} {]} - Display the
  \LaTeX compiler report on the final iteration.
\item
  \texttt{\textquotesingle{}echo=\textquotesingle{}} {[} \texttt{true}
  \textbar{} \emph{\texttt{false}} {]} - If \texttt{true}, the optional
  flag \texttt{\textquotesingle{}-echo\textquotesingle{}} will be used
  in the Matlab function \texttt{system} when compiling the PDF; this
  causes the screen output and all prompts to be displayed for each run
  of the compiler.
\item
  \texttt{\textquotesingle{}epsToPdf=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{Inf}} {]} - Command line arguments for
  EPSTOPDF; \texttt{Inf} means OS-specific arguments are used.
\item
  \texttt{\textquotesingle{}fontEnc=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{\textquotesingle{}T1\textquotesingle{}}} {]}
  - \LaTeX~font encoding.
\item
  \texttt{\textquotesingle{}makeTitle=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Produce title
  page (with title, author, date, and abstract).
\item
  \texttt{\textquotesingle{}package=\textquotesingle{}} {[} char
  \textbar{} cellstr \textbar{} \emph{empty} {]} - Package or list of
  packages that will be imported in the preamble of the LaTeX file.
\item
  \texttt{\textquotesingle{}paperSize=\textquotesingle{}} {[}
  \texttt{\textquotesingle{}a4paper\textquotesingle{}} \textbar{}
  \emph{\texttt{\textquotesingle{}letterpaper\textquotesingle{}}} {]} -
  Paper size.
\item
  \texttt{\textquotesingle{}orientation=\textquotesingle{}} {[}
  \emph{\texttt{\textquotesingle{}landscape\textquotesingle{}}}
  \textbar{} \texttt{\textquotesingle{}portrait\textquotesingle{}} {]} -
  Paper orientation.
\item
  \texttt{\textquotesingle{}preamble=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - \LaTeX~commands that will be placed in
  the \LaTeX~file preamble.
\item
  \texttt{\textquotesingle{}timeStamp=\textquotesingle{}} {[} char
  \textbar{}
  \emph{\texttt{\textquotesingle{}datestr(now())\textquotesingle{}}} {]}
  - String printed in the top-left corner of each page.
\item
  \texttt{\textquotesingle{}tempDir=\textquotesingle{}} {[} char
  \textbar{} function\_handle \textbar{} \emph{\texttt{tempname(pwd())}}
  {]} - Directory for storing temporary files; the directory is deleted
  at the end of the execution if it's empty.
\item
  \texttt{\textquotesingle{}maxRerun=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{5}} {]} - Maximum number of times the
  \LaTeX\\
  compiler will be run to resolve cross-references, etc.
\item
  \texttt{\textquotesingle{}minRerun=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{1}} {]} - Minimum number of times the
  \LaTeX\\
  compiler will be run to resolve cross-references, etc.
\item
  \texttt{\textquotesingle{}textScale=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{0.8}} {]} - Percentage of the total page area
  that will be used; the value can be either a scalar (the same
  percentage for the width and the height) or a 1-by-2 vector (the width
  and the height).
\end{itemize}

\paragraph{Description}

\subparagraph{\texorpdfstring{Difference between
\texttt{\textquotesingle{}display=\textquotesingle{}} and
\texttt{\textquotesingle{}echo=\textquotesingle{}}}{Difference between 'display=' and 'echo='}}

There are two differences between these otherwise similar options:

\begin{itemize}
\item
  When publishing the final PDF, the PDFLaTeX compiler may be called
  more than once to resolve cross-references, the table of contents, and
  so on. Setting
  \texttt{\textquotesingle{}display=\textquotesingle{}\ true} only
  displays the screen output from the final iteration only, while
  \texttt{\textquotesingle{}echo=\textquotesingle{}\ true} displays the
  screen outputs from all iterations.
\item
  In the case of a compiler error unrelated to the \LaTeX~code, the
  compiler may stop and prompt the user to respond. The prompt only
  appears on the screen when
  \texttt{\textquotesingle{}echo=\textquotesingle{}\ true}. Otherwise,
  Matlab may remain in a busy state with no on-screen information, and
  \texttt{Ctrl+C} may be needed to regain control.
\end{itemize}

\subparagraph{Information struct}

The second output argument, \texttt{Info}, is a struct with details of
building the PDF report. It contains the following fields:

\begin{itemize}
\item
  \texttt{.latexRun} -- the total number of LaTeX compiler runs needed
  to resolve cross-references and other dependencies;
\item
  \texttt{.figureHandle} -- a vector of figure window handles created
  during the report production process, and not closed (i.e.~still
  existing in the Matlab workspace); to keep figure windows open, use
  the figure object option
  \texttt{\textquotesingle{}close=\textquotesingle{}\ false}. If all
  \texttt{figure} and \texttt{userfigure} objects inside a report have
  \texttt{\textquotesingle{}close=\textquotesingle{}\ true} then
  \texttt{Info.figureHandle} will be empty.
\item
  \texttt{.tempDir} -- empty unless \texttt{publish} is called with
  \texttt{\textquotesingle{}cleanup=\textquotesingle{}\ false}; in that
  case, this is the name of a temporary directory in which all files are
  saved necessary to build the output PDF are saved.
\item
  \texttt{.tempFile} -- empty unless \texttt{publish} is called with
  \texttt{\textquotesingle{}cleanup=\textquotesingle{}\ false}; in that
  case, this is the list of all files (saved in the temporary directory)
  necessary to build the output PDF.
\end{itemize}

\paragraph{Example}


